package com.system.permissiondemo.mapper;

import com.system.permissiondemo.entity.SysDept;
import com.system.permissiondemo.entity.SysDeptExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface SysDeptMapper {
    long countByExample(SysDeptExample example);

    int deleteByExample(SysDeptExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(SysDept record);

    int insertSelective(SysDept record);

    List<SysDept> selectByExample(SysDeptExample example);

    SysDept selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") SysDept record, @Param("example") SysDeptExample example);

    int updateByExample(@Param("record") SysDept record, @Param("example") SysDeptExample example);

    int updateByPrimaryKeySelective(SysDept record);

    int updateByPrimaryKey(SysDept record);
    //全部数
    List<SysDept> getAllDept();

    List<SysDept> getChildDeptListByLevel(@Param("level")String level);
    //批量更新部门level
    void batchUpdateLevel(@Param("sysDepts")List<SysDept> sysDepts);
    //检查数据是否已存在：部门id，部门名称，上级部门id
    int countByNameAndParentId(@Param("id")Integer id,@Param("parentId")Integer parentId,@Param("name")String name);
}